package cn.iocoder.yudao.module.crossborder.platform.dal.mysql.platformwebhooklog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.platform.dal.dataobject.platformwebhooklog.PlatformWebhookLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.platform.controller.admin.platformwebhooklog.vo.*;

/**
 * 跨境电商平台Webhook事件日志 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PlatformWebhookLogMapper extends BaseMapperX<PlatformWebhookLogDO> {

    default PageResult<PlatformWebhookLogDO> selectPage(PlatformWebhookLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PlatformWebhookLogDO>()
                .eqIfPresent(PlatformWebhookLogDO::getWebhookId, reqVO.getWebhookId())
                .eqIfPresent(PlatformWebhookLogDO::getPlatformId, reqVO.getPlatformId())
                .eqIfPresent(PlatformWebhookLogDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(PlatformWebhookLogDO::getEventId, reqVO.getEventId())
                .eqIfPresent(PlatformWebhookLogDO::getEventType, reqVO.getEventType())
                .eqIfPresent(PlatformWebhookLogDO::getRequestHeaders, reqVO.getRequestHeaders())
                .eqIfPresent(PlatformWebhookLogDO::getRequestBody, reqVO.getRequestBody())
                .eqIfPresent(PlatformWebhookLogDO::getResponseStatus, reqVO.getResponseStatus())
                .eqIfPresent(PlatformWebhookLogDO::getResponseBody, reqVO.getResponseBody())
                .eqIfPresent(PlatformWebhookLogDO::getProcessStatus, reqVO.getProcessStatus())
                .betweenIfPresent(PlatformWebhookLogDO::getProcessTime, reqVO.getProcessTime())
                .eqIfPresent(PlatformWebhookLogDO::getProcessDuration, reqVO.getProcessDuration())
                .eqIfPresent(PlatformWebhookLogDO::getErrorMsg, reqVO.getErrorMsg())
                .eqIfPresent(PlatformWebhookLogDO::getRetryCount, reqVO.getRetryCount())
                .eqIfPresent(PlatformWebhookLogDO::getBusinessType, reqVO.getBusinessType())
                .eqIfPresent(PlatformWebhookLogDO::getBusinessId, reqVO.getBusinessId())
                .eqIfPresent(PlatformWebhookLogDO::getSourceIp, reqVO.getSourceIp())
                .eqIfPresent(PlatformWebhookLogDO::getUserAgent, reqVO.getUserAgent())
                .betweenIfPresent(PlatformWebhookLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PlatformWebhookLogDO::getId));
    }

}